#pragma once

#include <QtWidgets/QMainWindow>
#include <QEvent>
#include <QStandardItemModel>
#include <QButtonGroup>
#include "ui_HPDAQ_GUI.h"
#include "my_pub.h"

class HPDAQ_GUI : public QMainWindow
{
    Q_OBJECT

public:
    HPDAQ_GUI(QWidget *parent = Q_NULLPTR);
	void Show_Log_Event_Handle(QString s);
	void Show_Log(QString s);
	void Show_Log(const char *fmt, ...);
	QString Check_And_Create_Dir(QString dir_name);
	void InitWindow();
	void InitTableViewStat();
	QStandardItemModel *p_view_stat;

	void Save_Usr_Conf();
	void Load_Usr_Conf();
	void Show_Usr_Conf();
	void Fill_Cmd_Buf(u8 cmd_did);
	u8 Send_Uart_Cmd(u8 *buf, u8 len);
	u8 Get_Uart_Data_And_Show(u8 *buf, u8 len);
	void Show_Stat_Data();
	void get_stat();
	int timer_1000ms_id;
	void timerEvent(QTimerEvent *t);
	void closeEvent(QCloseEvent * event);
	void SetReadCount(u32 count);

public slots:

	void Slot_OnBtnDebug();
	void Slot_OnBtnUartOpen();
	void Slot_OnBtnUartClose();
	void Slot_OnBtnGetStat();
	void Slot_OnCkGetstatStateChanged(int);
	void Slot_OnCBIdIdxChanged(int);

private:
    Ui::HPDAQ_GUIClass ui;
	bool event(QEvent *e);
};